package com.hl.qzzpbackend.model.enums;

import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

/**
 * @Title: UserRoleEnum
 * @Author  helong
 * @Package com.hl.qzzpbackend.model.enums
 * @Date  2025/1/9 15:27
 * @description: 
*/
@Getter
public enum UserRoleEnum {

    JOB_SEEKER("求职者",0),
    EMPLOYER("招聘者",1),
    ADMIN("管理员",2),
    SUPER_ADMIN("超级管理员",3);

    private final String text;

    private final Integer value;

    UserRoleEnum(String text, Integer value) {
        this.text = text;
        this.value = value;
    }


    /**
     * 根据value获取枚举
     * @param value 枚举值的value
     * @return 枚举值
     */
    public static UserRoleEnum getEnumByValue(Integer value) {
        if(ObjUtil.isEmpty(value)) {
            return null;
        }
        for (UserRoleEnum userRoleEnum : UserRoleEnum.values()) {
            if (userRoleEnum.getValue().equals(value)) {
                return userRoleEnum;
            }
        }
        return null;
    }



}